package com.siruier.boss.api

import com.siruier.boss.api.core.ApiHelper
import com.siruier.boss.api.core.ResultBean
import com.siruier.boss.bean.City
import com.siruier.boss.bean.NumberListVO
import kotlinx.coroutines.CoroutineScope
import retrofit2.http.GET
import retrofit2.http.Query

val KAI_KA_API_SERVICE: KaiKaApiService by lazy { ApiHelper.create(KaiKaApiService::class.java) }

val CoroutineScope.kaiKa get() = KAI_KA_API_SERVICE

interface KaiKaApiService {
    /**
     * 查询支持开卡的城市列表
     */
    @GET("/api/open/cityList")
    suspend fun cityList(): ResultBean<MutableList<City>?>

    /**
     * 查询支持配送的城市列表
     */
    @GET("/api/open/jdCityList")
    suspend fun jdCityList(): ResultBean<MutableList<City>?>

    /**
     * 根据城市获取选号列表
     */
    @GET("/api/open/numberList")
    suspend fun numberList(
        @Query("cityCode") cityCode: Int,
        @Query("page") page: Int = 1,
    ): ResultBean<MutableList<NumberListVO>?>

    /**
     * 检测地址是否可以送达
     */
    @GET("/api/open/checkAddress")
    suspend fun checkAddress(
        @Query("provinceCode") provinceCode: Int,
        @Query("eparchyCode") eparchyCode: Int,
        @Query("address") address: String,
        @Query("servnumber") servnumber: String,
    ): ResultBean<Any?>

    /**
     * 移动开卡下单
     */
    @GET("/api/open/order")
    suspend fun order(
        @Query("address") address: String,
        @Query("addressCityCode") addressCityCode: Int,
        @Query("cerNo") cerNo: String,
        @Query("eparchyCode") eparchyCode: Int,
        @Query("provinceCode") provinceCode: Int,
        @Query("servnumber") servnumber: String,
        @Query("telno") telno: String,
        @Query("userName") userName: String,
    ): ResultBean<Any?>

}